package io.bsly.modules.app.controller;

import io.bsly.common.utils.PageUtils;
import io.bsly.common.utils.R;
import io.bsly.modules.app.entity.sourceEntity.RoomTypeDataEntity;
import io.bsly.modules.app.service.sourceDb.RoomTypeDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author fys
 * @email demo@gmail.com
 * @date 2021-09-26 15:33:56
 */
@RestController
@RequestMapping("app/roomtypedata")
public class RoomTypeDataController {
    @Autowired
    private RoomTypeDataService roomTypeDataService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = roomTypeDataService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		RoomTypeDataEntity roomTypeData = roomTypeDataService.getById(id);

        return R.ok().put("roomTypeData", roomTypeData);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody RoomTypeDataEntity roomTypeData){
		roomTypeDataService.save(roomTypeData);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody RoomTypeDataEntity roomTypeData){
		roomTypeDataService.updateById(roomTypeData);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		roomTypeDataService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
